#include<cstdio>//uncle-lu
#include<cstring>
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

struct node{
	int v, next;
};
node edge[1010];//边数
int head[110], cnt;
int n, m, s, t;
bool visit[110];

void add_edge(int x, int y)
{
	edge[++cnt].v = y;
	edge[cnt].next = head[x];
	head[x] = cnt;
	return ;
}

void DFS(int x)
{
	if(x == t)
		return ;

	for (int i = head[x]; ~i; i=edge[i].next) 
	{
		int v = edge[i].v;
		if(visit[v])continue;
		visit[v]=true;
		DFS(v);
	}

	return ;
}

int main()
{
	memset(head, -1, sizeof(head));
	read(n);read(m);
	int x, y;
	for (int i = 1; i <= m; i++) 
	{
		read(x); read(y);
		add_edge(x, y);
	}
	read(s);read(t);

	DFS(s);

	if(visit[t])
		printf("YES");
	else
		printf("NO");

	return 0;
}
